﻿
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<skags.Models.addTimelineViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Nýjar mælingar
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div id="navigation">
<% Html.RenderPartial("IndexNavigation"); %>
</div>
<div id="content">
<!--VELJA BARN -->
<%  if (Model.Children.Count() == 0)
    {
        Response.Write("Þú hefur ekki skráð nein börn.");
    }
    else
    {%>


    <% using (Html.BeginForm())
       {%>
        <%: Html.ValidationSummary(true, "Skráning mælinga tókst ekki. Vinsamlegast farið yfir það sem var sett inn og reynið aftur.")%>
        <div>
              <fieldset>
                <legend>Nýjar mælingar</legend>
                 <div class="editor-label">
                 <label for="ChildID">Veldu barn:</label>
                 
                </div>
                 <div class="editor-field">
                    <select name="ChildID">
                <%  foreach (var s in Model.Children)
                    {   %>    
                        <option value="<%= s.ID %>"><%: s.Name%></option>                 
                <%  }   %>
                </select>
                    <%: Html.ValidationMessageFor(model => model.ChildID)%>
                </div>
                <div class="editor-label">
                   <label for="LineDate">Dagsetning:</label>
                </div>
                <div class="editor-field">
                    <% Model.LineDate = DateTime.Now; %>
                    <%:Html.TextBoxFor(model => model.LineDate)%>
                    <%: Html.ValidationMessageFor(model => model.LineDate)%>
                </div>
                <script type="text/javascript">
                    $(function () {
                        $.datepicker.setDefaults($.datepicker.regional['is']);
                        $.datepicker.setDefaults({ dateFormat: 'dd/mm/yy' });
                        $("#LineDate").datepicker({ changeYear: true });
                        $("#LineDate").datepicker();
                    });
                </script>
            
                <div class="editor-label">
                    <label for="CHeight">Hæð:</label>
                </div>
                <div class="editor-field">
                    <%: Html.TextBoxFor(model => model.CHeight)%>
                    <%: Html.ValidationMessageFor(model => model.CHeight)%>
                </div>
            
                <div class="editor-label">
                    <label for="CWeight">Þyngd:</label>    
                </div>
                <div class="editor-field">
                    <%: Html.TextBoxFor(model => model.CWeight)%>
                    <%: Html.ValidationMessageFor(model => model.CWeight)%>
                </div>
               
                <input type="submit" name="submit_measurements" value="Skrá" />
                <%: Html.ActionLink("Til Baka", "WhoCurve") %>
           </fieldset> 
           
          </div>
         
               

    <% } //END FORM
    } //END ELSE%>
    <div>
    </div>
</asp:Content>